You can use other forms of the Select Case statement. For example, you can use a comma-delimited list when you need to have the same block of code run for different cases. You can also use the To operator if you have a range of numbers that will run the same block of code.
Heres the second example:
Select Case CCur(txtSalary.Text)
Case 0 To 40000
MsgBox "Tax Rate is 15%"
Case 40001 To 60000
MsgBox "Tax Rate is 24%"
Case 60001 To 80000
MsgBox "Tax Rate is 28%"
Case 80001 To 10000000
MsgBox "Tax Rate is 38%"
End Select
In this code, the CCur() function is used to convert the value in the text box to a currency value.
Heres a third example:
Select Case txtCity.Text
Case "Tustin", "Irvine", "Orange"
MsgBox "Inform employee of carpool options"
Case "Mission Viejo", "Newport Beach"
MsgBox "Inform employee of transportation options"
End Select
TIP When coding Case statements, place the most commonly used cases first. This will improve the performance of the Case statement.
Compiler Directives
Compiler directives are used when you need to change the way your program is compiled. Compiler directives are If statements that direct the compiler as to which code to leave in and which code to take out. For example, you might want